<template>
	<view class="cateList">
		<view class="cateList-item" v-for="(item,index) in list" :key="item.cateId" 
		@click="goCateList(index)">
			<image class="image" lazy-load :lazy-load-margin="0" mode="aspectFill" :src="item.logo"></image>
			<view class="name">{{item.name}}</view>
		</view>
	</view>
</template>

<script>
export default {
		name: "cateList",
		props:{
			list: Array,
		},
		methods:{
			goCateList(index){
				uni.setStorageSync('category_index', index);
				uni.switchTab({
					url:'/pages/category/index',
					success(){
					}
				})
			}
		}
}
</script>

<style lang="scss" scoped>
	.cateList{
		// margin: 10rpx;
		display: flex;
		flex-wrap:wrap;
			
		.cateList-item{
			margin:0.9rem;
			.image{
				border-radius: 25rpx;
				width: 120rpx;
				height: 120rpx;
			}
			.name{
				text-align: center;
			}
		}
	}
</style>